﻿using System;
using System.Diagnostics;
using Microsoft.Win32;
using FX.CC.Andon.Entity.SystemManage;
using FX.CC.Andon.WebSite.UI;

namespace FX.CC.Andon.WebSite
{
    public partial class welcome : BasicPage
    {
        public SysParameterEntity Model;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Model = new SysParameterEntity();
                Model.ServerName = "http://" + Request.Url.Host;
                Model.Ip = Request.ServerVariables["LOCAl_ADDR"].ToString();
                Model.Port = Request.ServerVariables["Server_Port"].ToString();
                Model.IISVer = Request.ServerVariables["Server_SoftWare"].ToString();
                Model.PhPath = Request.PhysicalApplicationPath;
                Model.Operat = Environment.OSVersion.ToString();
                Model.SystemPath = Environment.SystemDirectory.ToString();
                Model.AspnetVer = string.Concat(new object[] { Environment.Version.Major, ".", Environment.Version.Minor, Environment.Version.Build, ".", Environment.Version.Revision });
                Model.CurrentTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Version Vector");
                Model.IEVer = key.GetValue("IE", "未检测到").ToString();
                Model.ServerLastStartToNow = ((Environment.TickCount / 0x3e8) / 60).ToString() + "分钟";
                Model.MemoryPro = ((Double)GC.GetTotalMemory(false) / 1048576).ToString("N2") + "M";
                Model.MemoryNet = ((Double)Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + "M";
                Model.CpuNet = ((TimeSpan)Process.GetCurrentProcess().TotalProcessorTime).TotalSeconds.ToString("N2");
            }
        }
    }
}